<?php
/**
* Controller cho sp
*/
class ProductsController extends ControllerBase
{
	public function initialize()
    {
        $this->tag->setTitle('Danh sách sản phẩm');
        parent::initialize();
    }
    public function indexAction() {
    	$request = new Phalcon\Http\Request();
    	$id = $request->getQuery('id',null,'');
        if($id == '') {
            $id = $this->dispatcher->getParam("id");
        }
    	$danhmuc = Menu::findFirst("id = $id");
    	$products = Product::find(array(
    			"vg_dm_id = $danhmuc->vg_dm_id",
				"limit" => 20
    		)
    	);
    	$this->view->setVar('products',$products);
    }
}
?>